home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 05.zip / BS1 part 5 / IM_Install1.adf / install-im < prev    next >
Text File  |  1992-09-03  |  18KB  |  498 lines

  1. ; CBM installer script to install Imagemaster on users hard-drive
  2. ;     Written: August 26th, 1992
  3. ; Last update: August 31st, 1992
  4. ;          by: Ben Williams
  5. ;----------------------------------------------------------------
  6. ;Notes:
  7. ;------->
  8. ;  (1) We force a minimum level of AVERAGE user so that they
  9. ;      must specify the target directory for the install and
  10. ;      answer some basic questions such as "Do you have an FPU"
  11. ;
  12. ;  (2) There must be sufficient diskspace to install the software
  13. ;      or we can't install.
  14. ;
  15. ;  (3) ARexx must be available, or we can't install
  16. ;----------------------------------------------------------------
  17.  
  18. ; cleanup routine
  19. ;----------------
  20. (onerror)
  21.  
  22. ; Make certain rexx: directory exists - if ARexx isn't running, we
  23. ; can (sortof) live with that, though the user will be seriously
  24. ; crippled in capability. If no assignment exists, we're toast
  25. ;-----------------------------------------------------------------
  26. (if (= (getassign "rexx") "")
  27.     (abort "Cannot install - no REXX: assignment in this system. "
  28.            "You MUST have ARexx and a drawer assigned to REXX: "
  29.            "to hold ARexx scripts in order to successfully "
  30.            "install Imagemaster. Please properly configure "
  31.            "your computer and try again. If you do not know how "
  32.            "to accomplish this, call your dealer or consultant."
  33.     )
  34. )
  35.  
  36. ; Find out where user wants to put Imageaster
  37. ;----------------------------------------------
  38. (set user_place
  39.     (askdir
  40.         (prompt "Where shall we place the Imagemaster DRAWER? ")
  41.         (help @askdir-help "It is important that you realize that the destination you specify here "
  42.                            "is for the DRAWER in which Imagemaster and it's associated data files "
  43.                            "will be placed. Even if this is an update to an earlier installation, "
  44.                            "you still need to specify this location the same way. Otherwise, a new "
  45.                            "\"Imagemaster\" drawer will be created INSIDE your old one, causing "
  46.                            "much confusion and not amusing anyone.")
  47.         (default @default-dest)
  48.     )
  49. )
  50.  
  51. ; Check to see if assigns are already made
  52. ;-----------------------------------------
  53. (set as_made 0)
  54. (if (<> (getassign "rxpi:") "")
  55.     (if (<> (getassign "cmpi:") "")
  56.         (set as_made 1)
  57.     )
  58. )
  59.  
  60. ; Find out if user wants the developer code
  61. ;------------------------------------------
  62. (set dev_install
  63.     (askoptions
  64.         (prompt "Would you like to have the Public Interface developer "
  65.                 "C and ARexx code, with documentation? This will allow "
  66.                 "you to create public interface modules of your own, if "
  67.                 "you own the SAS C compiler and have typical Amiga "
  68.                 "developer skills.")
  69.                 (help @askoptions-help "If you are NOT a technical type, "
  70.                 "you have no need for this data. If you are, then by all "
  71.                 "means install it!")
  72.         (choices "Install SAS C and ARexx developer code?")
  73.         (default 0)
  74.     )
  75. )
  76.  
  77. ; Check with user if they want the docs on-disk
  78. ;----------------------------------------------
  79. (set doc_install
  80.     (askoptions
  81.         (prompt "Would you like to install the additional documents "
  82.                 "into the Imagemaster drawer? This is not usually "
  83.                 "necessary, because they can be printed by clicking "
  84.                 "on the \"print-docs\" icon at any time, if you have "
  85.                 "a printer.")
  86.         (help "If you do NOT have a printer, you'll have to read the "
  87.               " documents using a text editor, and you SHOULD install "
  88.               "them to the Imagemaster drawer. "
  89.               @askoptions-help)
  90.         (choices "Install addendum into Imagemaster drawer?")
  91.         (default 0)
  92.     )
  93. )
  94.  
  95. ; Check with user if they want the floating point version
  96. ;--------------------------------------------------------
  97. (set float_install
  98.     (askchoice
  99.         (prompt "Do you have a floating-point unit (FPU)? ")
  100.         (help "An FPU is a special hardware mathematics processor "
  101.               "which allows a computer which uses it to figure out "
  102.               "answers to math problems using floating point math "
  103.               "much faster than it could without an FPU. A 68000 "
  104.               "Amiga has no FPU. 68020 or 68030 based-Amigas may "
  105.               "have an FPU - check your documentation if you're not "
  106.               "certain. 68040-based Amigas always have the FPU built "
  107.               "right in. The non-FPU version will work on an Amiga "
  108.               "with an FPU, however it will be much slower which "
  109.               "will cost you unecessary time when processing images. "
  110.               @askchoice-help)
  111.         (choices "Install Floating Point (FPU) version"
  112.                  "Install standard (NON-FPU) version")
  113.         (default 1)
  114.     )
  115. )
  116.  
  117. ; We know where Imagemaster is to be installed now, we'll do some
  118. ; checking to make sure that we have enough room for the installation.
  119. ; The IM release is (approximately) sized as follows:
  120. ;---------------------------------------------
  121. ; Imagemaster ------------------- 1400000 bytes
  122. ; FilmView ----------------------   45000 bytes
  123. ; IShapes -----------------------   21000 bytes
  124. ; Addendum file -----------------  190000 bytes
  125. ; Developer stuff ---------------   16000 bytes
  126. ; Public Interface Modules ------ 1300000 bytes
  127. ;                                 -------
  128. ;                       Total:    2972000 bytes - about 3 megabytes
  129. ;-----------------------------------------------------------------------
  130. (set tgt_space  (getdiskspace user_place))
  131. (set total_size 3000000)
  132. (if (= dev_install 0)
  133.     (set total_size (- total_size "16000"))
  134. )
  135. (if (= doc_install 0)
  136.     (set total_size (- total_size "190000"))
  137. )
  138.  
  139. ; If we can't do the main install, quit immediately
  140. ;
  141. (if (< tgt_space total_size)
  142.     (abort "This installation requires about " ("%ld" total_size)
  143.            " bytes free on the "
  144.            "volume where you wish to install Imagemaster. Please "
  145.            "make this space available and then re-install. For your "
  146.            "information, the volume you have selected has only "
  147.            ("%ld " tgt_space) "bytes free. You need "
  148.            ("%ld " (- total_size tgt_space)) "more bytes.")
  149. )
  150.  
  151. ; We'll need our compressed-file extraction command:
  152. ;---------------------------------------------------
  153. (set src_disk "IM_Install2:")
  154. (askdisk
  155.     (prompt "Please insert Imagemaster diskette #2")
  156.     (help "We need to copy some files from this diskette.")
  157.     (dest "IM_Install2")
  158. )
  159.  
  160. ; Get the extract command
  161. ;------------------------
  162. (copyfiles (source src_disk)
  163.            (dest "ram:")
  164.            (pattern "extract")
  165.            (files)
  166. )
  167.  
  168. ; Now we'll get a grip on our installation volume
  169. ;------------------------------------------------
  170.  
  171. (set src_one "IM_Install1")
  172. (set src_two "IM_Install2")
  173. (set src_three "IM_Install3")
  174. ; We've got the target; now we need to make sure that we have our main DIR
  175. ;-------------------------------------------------------------------------
  176. (
  177.     (set im_dest (tackon user_place "Imagemaster"))
  178.     (if (not (exists im_dest))
  179.         (makedir im_dest (infos))
  180.     )
  181.     (set @default-dest im_dest)
  182. )
  183.  
  184. ; Create subordinate target strings
  185. ;----------------------------------
  186. (set rxpi_dir (tackon im_dest "rxpi"))
  187. (set cmpi_dir (tackon im_dest "cmpi"))
  188. (set ish_dir  (tackon im_dest "IShapes"))
  189. (set dev_dir  (tackon im_dest "Developer"))
  190. (set doc_dir  (tackon im_dest "Docs"))
  191. (set rexx_dir "rexx:")
  192.  
  193. ; Create RXPI drawer if it's not already there
  194. ;-------------------------------------------------
  195. (if (not (exists rxpi_dir))
  196.     (makedir rxpi_dir (infos))
  197. )
  198.  
  199. ; Create CMPI drawer if it's not already there
  200. ;-------------------------------------------------
  201. (if (not (exists cmpi_dir))
  202.     (makedir cmpi_dir (infos))
  203. )
  204.  
  205. ; Create IShapes drawer if it's not already there
  206. ;------------------------------------------------
  207. (if (not (exists ish_dir))
  208.     (makedir ish_dir (infos))
  209. )
  210.  
  211. ; make assignments so user can operate immediately
  212. ;-------------------------------------------------
  213. (makeassign "RXPI" rxpi_dir (safe))
  214. (makeassign "CMPI" cmpi_dir (safe))
  215.  
  216. ; Check to see if user has old rxpi and cmpi installation
  217. ; If so, copy those files to the new location in case they
  218. ; have any aftermarket or custom PI modules in there...
  219. ;--------------------------------------------------------
  220. (if (exists "rexx:rxpi")
  221.     (
  222.         (set as_made 0) ; because we are in a new location!
  223.         (copyfiles (source "rexx:cmpi") (dest "rxpi:")
  224.                    (pattern "#?") (files))
  225.         (run "delete rexx:rxpi/#? QUIET")
  226.         (run "delete rexx:rxpi QUIET")
  227.     )
  228. )
  229.  
  230. (if (exists "c:cmpi")
  231.     (
  232.         (set as_made 0) ; because we are in a new location!
  233.         (copyfiles (source "c:cmpi") (dest "cmpi:")
  234.                    (pattern "#?") (files))
  235.         (run "delete rexx:cmpi/#? QUIET")
  236.         (run "delete rexx:cmpi QUIET")
  237.     )
  238. )
  239.  
  240. ; copy things we KNOW we need
  241. ;----------------------------
  242. (set imp_src src_two)
  243. (askdisk
  244.     (prompt ("Please insert the %s diskette " imp_src))
  245.     (help "This diskette is absolutely required to complete this "
  246.           "installation!")
  247.     (dest imp_src)
  248. )
  249. (copyfiles (source (cat imp_src ":"))
  250.            (dest "ram:")
  251.            (pattern "(ish.lzh|fv.lzh|imi.lzh)")
  252.            (files)
  253. )
  254.  
  255. ; Extract this portion of the installation
  256. ;-----------------------------------------
  257. (run ("ram:extract e ram:imi %s/" im_dest))
  258. (run ("ram:extract e ram:fv %s/" im_dest))
  259. (run ("ram:extract e ram:ish %s/" ish_dir))
  260.  
  261. ; Decide about .info file name
  262. ;-----------------------------
  263. (if (= float_install 0)
  264.     (rename (tackon im_dest "iminfo") (tackon im_dest "imf.info")) ; then
  265.     (rename (tackon im_dest "iminfo") (tackon im_dest "im.info")) ; else
  266. )
  267.  
  268. ; Clean up after these archives
  269. ;------------------------------
  270. (delete "ram:ish.lzh")
  271. (delete "ram:fv.lzh")
  272. (delete "ram:imi.lzh")
  273.  
  274. ; Now, we'll extract the main image processor after figuring out which ver
  275. ;-------------------------------------------------------------------------
  276. (set imp_src src_two)
  277. (set proc_file "ima.lzh")
  278. (if (= float_install 0)
  279.     (
  280.         (set imp_src src_one)
  281.         (set proc_file "imb.lzh")
  282.     )
  283. )
  284.  
  285. ; Ask for the proper diskette
  286. ;----------------------------
  287. (askdisk
  288.     (prompt ("Please insert the %s diskette " imp_src))
  289.     (help "This diskette is absolutely required to complete this "
  290.           "installation!")
  291.     (dest imp_src)
  292. )
  293.  
  294. ; This gets the needed archive from the proper disk
  295. ;--------------------------------------------------
  296. (copyfiles (source (cat imp_src ":"))
  297.            (dest "ram:")
  298.            (pattern proc_file)
  299.            (files)
  300. )
  301.  
  302. ; Warn user about extraction time
  303. ;--------------------------------
  304. (message "At this point, we'll be extracting the main program into "
  305.          "the target drawer. This will take considerable time. Please "
  306.          "be patient. Thank you!")
  307.  
  308. ; Here, we extract the image processor, copying it at the same time
  309. ;------------------------------------------------------------------
  310. (run ("ram:extract e ram:%s %s/" proc_file im_dest))
  311.  
  312. ; Delete the image processor archive
  313. ;-----------------------------------
  314. (delete ("ram:%s" proc_file))
  315.  
  316. ; Now we'll go after the two optional installs and the PI modules
  317. ;----------------------------------------------------------------
  318. (set imp_src src_three)
  319. (askdisk
  320.     (prompt ("Please insert the %s diskette " imp_src))
  321.     (help "This diskette is absolutely required to complete this "
  322.           "installation!")
  323.     (dest imp_src)
  324. )
  325.  
  326. ; If user wants the developer stuff, install it
  327. ;----------------------------------------------
  328. (if (= dev_install 1)
  329.     (
  330.         (if (not (exists dev_dir))
  331.             (makedir dev_dir (infos))
  332.         (copyfiles (source (cat imp_src ":"))
  333.                    (dest "ram:")
  334.                    (pattern "dd.lzh")
  335.                    (files))
  336.         (run ("ram:extract e ram:dd %s/" dev_dir))
  337.         (delete "ram:dd.lzh")
  338.         )
  339.     )
  340. )
  341.  
  342. ; If user wants the documents, install them
  343. ;------------------------------------------
  344. (if (= doc_install 1)
  345.     (
  346.         (if (not (exists doc_dir))
  347.             (makedir doc_dir (infos))
  348.         (copyfiles (source (cat imp_src ":"))
  349.                    (dest "ram:")
  350.                    (pattern "ia.lzh")
  351.                    (files)
  352.         )
  353.         (run ("ram:extract e ram:ia %s/" doc_dir))
  354.         (delete "ram:ia.lzh")
  355.         )
  356.     )
  357. )
  358.  
  359. ; Now for the FUN part... get the PI modules installed
  360. ; Begin by backing up old macro file(s), if they exist
  361. ;-----------------------------------------------------
  362. (if (exists "s:Default.immcr.old")
  363.     (delete "s:Default.immcr.old"))
  364. (if (exists "s:Default.immcr")
  365.     (rename "s:Default.immcr" "s:Default.immcr.old"))
  366. ;---------------
  367. (if (exists "s:Default.iimcr.old")
  368.     (delete "s:Default.iimcr.old"))
  369. (if (exists "s:Default.iimcr")
  370.     (rename "s:Default.iimcr" "s:Default.iimcr.old"))
  371. ;---------------
  372. (if (exists "s:Default.ipmcr.old")
  373.     (delete "s:Default.ipmcr.old"))
  374. (if (exists "s:Default.ipmcr")
  375.     (rename "s:Default.ipmcr" "s:Default.ipmcr.old"))
  376. ;---------------
  377.  
  378. ; Old macros are backed up, ready for main PI install
  379. ; Get the archive....
  380. ;----------------------------------------------------
  381. (makedir "ram:gbzyx")
  382. (copyfiles (source (cat imp_src ":"))
  383.            (dest "ram:")
  384.            (pattern "piarc.lzh")
  385.            (files)
  386. )
  387.  
  388. ; Warn user about extraction time
  389. ;--------------------------------
  390. (message "At this point, we'll be extracting some files into "
  391.          "the ram disk. This will take considerable time. Please "
  392.          "be patient. Thank you!")
  393.  
  394. ; Now really extract the darn stuff!
  395. ;-----------------------------------
  396. (run ("ram:extract e ram:piarc ram:gbzyx/"))
  397. (delete "ram:piarc.lzh")
  398.  
  399. ; Archive is unpacked and ready to copy
  400. ; first, backup list.list if available
  401. ;--------------------------------------
  402. (if (exists "cmpi:list.list")
  403.     (
  404.         (if (exists "cmpi:list.list.old")
  405.             (delete "cmpi:list.list.old")
  406.         )
  407.         (rename "cmpi:list.list" "cmpi:list.list.old")
  408.         (message "Please note that during installation, your previous "
  409.                  "\"list.list\" file was located and renamed to "
  410.                  "\"list.list.old\". All of your aftermarket PI "
  411.                  "modules (if any) are still intact, but will not "
  412.                  "show up on PI lists untill the new list.list file "
  413.                  "has been appropriately modified."
  414.          (help   "This has been done so that you may refer to it if "
  415.                  "you had aftermarket PI modules declared in it. "
  416.                  "A new list.list file has been created as part of "
  417.                  "this install procedure - you should use this new "
  418.                  "list.list file instead of the old one (that will "
  419.                  "happen automatically) but if you DID have any "
  420.                  "aftermarket PI modules, such as Metadigm's ES300c "
  421.                  "scanner driver, you'll need to add the control "
  422.                  "line(s) for it (them) into the new list.list file. "
  423.                  "You would then use the old list.list file as a template "
  424.                  "to accomplish this.")
  425.         )
  426.     )
  427. )
  428.  
  429. ; move the "odd" files (not PI rexx or PI cmds)
  430. ;-----------------------------------------------------
  431. (copyfiles (source "ram:gbzyx") (dest "rexx:")
  432.            (pattern "(picmdpath|launch.rexx)") (files))
  433. (copyfiles (source "ram:gbzyx") (dest "s:")
  434.            (pattern "(default.??mcr)") (files))
  435. (copyfiles (source "ram:gbzyx") (dest "cmpi:")
  436.            (pattern "list.list") (files))
  437. (delete "ram:gbzyx/picmdpath")
  438. (delete "ram:gbzyx/list.list")
  439. (delete "ram:gbzyx/launch.rexx")
  440. (delete "ram:gbzyx/Default.??mcr")
  441.  
  442. ; Next, copy all the PI ARexx scripts
  443. ;------------------------------------
  444. (copyfiles (source "ram:gbzyx") (dest "rxpi:")
  445.            (pattern "#?.rexx") (files))
  446. (run "delete ram:gbzyx/#?.rexx QUIET")
  447.  
  448. ; Next, copy all the PI Commands
  449. ;-------------------------------
  450. (copyfiles (source "ram:gbzyx") (dest "cmpi:")
  451.            (pattern "#?") (files))
  452.  
  453. ; Now, we have to decide if we can install the FPU PI modules
  454. ;------------------------------------------------------------
  455. (if (exists "CMPI:rdjpg") (delete "CMPI:rdjpg"))
  456. (if (exists "CMPI:wrjpg") (delete "CMPI:wrjpg"))
  457. (if (= float_install 0)
  458.     ((rename "CMPI:x_JPR030" "CMPI:rdjpg")  ; then
  459.      (rename "CMPI:x_JPW030" "CMPI:wrjpg"))
  460.     ((rename "CMPI:x_JPR000" "CMPI:rdjpg")  ; else
  461.      (rename "CMPI:x_JPW000" "CMPI:wrjpg"))
  462. )
  463.  
  464. ; clean up
  465. ;---------
  466. (run "delete CMPI:x_#? QUIET")
  467. (run "delete ram:gbzyx/#? QUIET")
  468. (delete "ram:gbzyx")
  469. (delete "ram:extract")
  470.  
  471. ; Add assignment to user's "user-startup" directory for new boot ops
  472. ; IF they were not already correctly done
  473. ;-------------------------------------------------------------------
  474. (if (= as_made 0)
  475.     (startup "Imagemaster"
  476.         (help "This operation adds lines to your user-startup file "
  477.               "which are harmless assignment statements to drawers "
  478.               "within the Imagemaster drawer, called \"RXPI:\" and "
  479.               "\"CMPI:\" each time you boot your Amiga. These assignments "
  480.               "are used to let Imagemasters Public Interface (PI) drivers know "
  481.               "where its data files reside. Unless you know that you have "
  482.               "another assignment with one of these names, it is extremely "
  483.               "unlikely that there would be any reason to NOT let this happen. "
  484.               "Note that if this is a reinstall, but it is the first time "
  485.               "you have installed using this installation procedure, you "
  486.               "SHOULD allow these assigns to be made, even if you had "
  487.               "assigns to RXPI and CMPI you created yourself. The PI "
  488.               "modules are now kept in a different location, so these new "
  489.               "assignments are necessary.")
  490.         (prompt "Is it o.k. to add two SAFE lines to your User-Startup "
  491.                 "file?")
  492.         (command ("assign RXPI: %s\n" rxpi_dir))
  493.         (command ("assign CMPI: %s" cmpi_dir))
  494.     )
  495. )
  496.  
  497. (exit)
  498.